package pers.jassor.rest;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ConfigClientRest {
	
	// 加载配置文件信息
	
	@Value("${spring.application.name}")
	private String applicationName;
	
	@Value("${eureka.client.service-url.defaultZone}")
	private String eurekaServers;

	@Value("${server.port}")
	private String port;

	// 用web访问的方式测试能否正常读取到配置
	
	@RequestMapping("/config")
	public String getConfig() {
		String format = "applicationName:%s\t eurekaServers:%s\t port:%s";
		return String.format(format, applicationName, eurekaServers, port);
	}

}
